Jul 95 Challenge
Volume Number: 11
Issue Number: 7
Column Tag: Programmer’s Challenge
Programmer’s Challenge
By Bob Boonstra and Mike Scanlin
Note: Source code files accompanying article are located on MacTech CD-ROM or
source code disks.
Goodbye Mike
[Most of you are well aware of the excellence Mike Scanlin has brought to the
magazine since the summer of 1992. Back then, Mike suggest to me that we start a
programming puzzle to encourage programmers to write efficient code. Like many
quality programmers, Mike was concerned that with the advent of faster machines,
programmers were becoming lax in their ways.
The MacTech Programmer’s Challenge grew out of these conversations into the
industry icon it is today. We’ve been stopped at trade shows and user group meetings
by folks who are proudly wearing their MacTech Programmer’s Challenge Winner
t-shirts. They should be proud - it is an accomplishment. We’re thrilled that the
Challenge has had this impact on the developer community.
As publisher, working with Mike has been an absolute joy. After almost three
years of running the challenge and devising puzzles, Mike is moving on. While his
career has spanned such greats like WriteNow, PhotoFlash, and today General Magic,
Mike cares about you all, the Challenge, and the magazine. So together, we’ve
hand-picked someone we feel is the most qualified successor - Bob Boonstra.
Some of you might recognize Bob as a regular participant (and all-time winner)
in past Challenges. Bob’s passion for efficiency dates back to his self-taught
introduction to programming, starting in hex, then assembly language, and only later
graduating to high level languages. He is a member of the Value-Added NewsWatcher
team, adding a few features to John Norstad’s excellent newsreader. When he isn’t
writing or reverse engineering code (or working at an unspecified day job), Bob
spends time introducing his 8- and 10-year old children to the joys of hiking in the
White Mountains, and to the world of Macintosh, but usually not both at the same time.
We wish Mike the best of luck and we welcome Bob with open arms. We hope you
do as well. Ed./Pub. -nst]
Sprite Blitz
Most of you are probably familiar with the great shareware arcade games that are
available for the Mac. This month you will be writing a key element of an arcade game
- the code that moves graphic elements (“sprites”) across a background. There are a
number of libraries that do much of this work for the aspiring game writer, but I want
to see how fast you can do it, and hopefully we will all benefit from the techniques in
the winning code.
The prototypes of the code you must write are as follows:
void StartGame(
/* pointer to CWindow */
CWindowPtr theWind
);
short /*theSpriteID*/ AddSprite(
/* pointer to ‘cicn' */
CIconPtr theSprite,
/* initial sprite location */
Point startLoc
); /* returns sprite ID to be used in MoveSprite, DeleteSprite */
void DeleteSprite(
/* ID of sprite to delete */